﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:w="http://schemas.jelle.druyts.net/2010/xaml/presentation"
             x:Class="Schedulr.Views.Logo"
             d:DesignHeight="100"
             d:DesignWidth="300"
             mc:Ignorable="d"
             DataContext="{Binding Path=LogoViewModel, Source={StaticResource Locator}}">
    <StackPanel>
        <StackPanel.Resources>
            <Style x:Key="FaderStyle" TargetType="{x:Type TextBlock}">
                <Style.Resources>
                    <Storyboard x:Key="FadeStoryboard">
                        <DoubleAnimation Storyboard.TargetProperty="(TextBlock.Opacity)" From="0.6" To="0.8" Duration="0:0:0.5" RepeatBehavior="0:0:5" AutoReverse="True" />
                    </Storyboard>
                </Style.Resources>
                <Style.Triggers>
                    <Trigger Property="Visibility" Value="Visible">
                        <Trigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource FadeStoryboard}" />
                        </Trigger.EnterActions>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </StackPanel.Resources>
        <Border x:Name="reflectedVisual" Background="Transparent">
            <TextBlock Margin="0,0,0,-5" FontFamily="Segoe UI" FontSize="26" FontWeight="Bold" TextWrapping="NoWrap">
                <!-- Grayscale version: -->
                <!--
                <Run Foreground="#545454">Flick</Run><Run Foreground="#9B9B9B">r</Run>
                <Run Foreground="#545454">Schedul</Run><Run Foreground="#9B9B9B">r</Run>
                -->
                <!-- Color version: Blue = R0 G99 B220 or #0063DC, Pink = R255 G0 B132 -->
                <Run Foreground="#0063DC">Flick</Run><Run Foreground="#FF0084">r</Run>
                <Run Foreground="#0063DC">Schedul</Run><Run Foreground="#FF0084">r</Run>
                <TextBlock Foreground="{DynamicResource UserMessageFontBrush}" FontSize="14" Text="{Binding ApplicationVersion}" />
            </TextBlock>
        </Border>
        <!-- Create a reflection of the visual above. -->
        <Border Height="{Binding ElementName=reflectedVisual, Path=ActualHeight}" Width="{Binding Path=ActualWidth, ElementName=reflectedVisual}">
            <Border.Background>
                <VisualBrush Opacity="0.75" Visual="{Binding ElementName=reflectedVisual}">
                    <VisualBrush.RelativeTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="-1" />
                            <TranslateTransform Y="1" />
                        </TransformGroup>
                    </VisualBrush.RelativeTransform>
                </VisualBrush>
            </Border.Background>
            <Border.OpacityMask>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="#FF000000" Offset="0.0" />
                    <GradientStop Color="#11000000" Offset="0.6" />
                    <GradientStop Color="#00000000" Offset="0.75" />
                </LinearGradientBrush>
            </Border.OpacityMask>
            <Border.BitmapEffect>
                <BlurBitmapEffect Radius="3.0" />
            </Border.BitmapEffect>
        </Border>
        <TextBlock FontSize="12" Margin="0,-20,0,0" HorizontalAlignment="Center" Style="{StaticResource FaderStyle}" Opacity="0.6" Visibility="{Binding NewVersionVisibility}">
            <w:ExternalHyperlink Foreground="#FF0084" NavigateUri="{Binding NewVersionUrl}" ><Run Text="{Binding NewVersionMessage}" /></w:ExternalHyperlink>
        </TextBlock>
    </StackPanel>

</UserControl>